<template>
  <div></div>
</template>

<script>
import Vue from 'vue';
import { fetchData } from '../api/index';
import _ from "lodash";
import Grid from '../components/common/Grid';
import LineECharts from '@/components/dashboard/LineECharts';
export default {
    name: 'dashboard',
    destroyed() {
        this.searchEventBus.$off();
    },
    data() {
        this.searchEventBus = new Vue();
        return {
            name: localStorage.getItem('ms_username'),
            collapse: false,
            dateSelectList: ['今天','昨天','过去7天','过去30天','本周','上周','本月','上月'],     // 可选日期列表
            mediaAccountList: ['媒体账号1','媒体账号2','媒体账号3','媒体账号4'],    // 媒体账号列表
            applicationList: ['应用1','应用2','应用3','应用4','应用5'],    // 应用列表
            mediaTypeList: ['今日头条','广点通','快手'],     // 媒体类型列表
            
            searchForm:{     // 今日头条和效果总览的查询参数
                date: "",
                date2: "",
                mediaAccount: "",
                application: "",
                mediaType: ""
            },
            searchFormTop:{    // TOP广告和TOP创意的查询参数
                applicationTop: "",    // TOP广告
                mediaTypeTop: "",
                dateTop: "",
                applicationTop2: "",   // TOP创意
                mediaTypeTop2: "",
                dateTop2: "",
            },
            columnTopAd: [    // TOP广告的数据表格
            {
                title: "计划名称",
                key: "planName",
                minWidth: 220,
                tooltip: true
            },
            {
                title: "消耗",
                key: "expend",
                tooltip: true,
                minWidth: 100,
            },
            {
                title: "消耗变化率",
                key: "expendRate",
                minWidth: 100,
                tooltip: true,
            },
            {
                title: "转化数",
                key: "TransformNumber",
                minWidth: 100,
                tooltip: true,
            },
            {
                title: "转化率",
                key: "TransformRate",
                minWidth: 100,
                tooltip: true,
            },
        ],
        columnTopIdea:[    // TOP创意的数据表格

        ],
        };
    },
    components: {
        Vue,
        Grid,
        LineECharts
    },
    created() {
        
    },
    computed: {
        role() {
            return this.name === 'admin' ? '超级管理员' : '普通用户';
        }
    },
    methods: {
        //获取页码及每页条数
        currentPage(val){
        this.current = val;
        },
        pageSize(val){
        this.pageNum = val;
        },
        changeSort() {},
        selectionChange() {},
        changeDate() {
            const now = new Date().getTime();
            this.data.forEach((item, index) => {
                const date = new Date(now - (6 - index) * 86400000);
                item.name = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
            });
        },
        setColor(dataVal){
            if(dataVal > 0){
                return 'overview-list-trend-up';
            }else{
                return 'overview-list-trend-down';
            }
        }
    }
};
</script>


<style scoped>

</style>
